package demoMod.invincibleOne.patches;

import com.evacipated.cardcrawl.modthespire.lib.SpirePatch;
import com.evacipated.cardcrawl.modthespire.lib.SpireReturn;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.rewards.RewardItem;
import demoMod.invincibleOne.InvincibleOneMod;
import demoMod.invincibleOne.characters.InvincibleOne;

public class RewardItemPatch {
    @SpirePatch(
            clz = RewardItem.class,
            method = "claimReward"
    )
    public static class PatchClaimReward {
        public static SpireReturn<Boolean> Prefix(RewardItem item) {
            if (item.type == RewardItem.RewardType.POTION && AbstractDungeon.player instanceof InvincibleOne) {
                if (InvincibleOneMod.seriousLevel[CardCrawlGame.saveSlot] < 4) {
                    AbstractDungeon.player.gainGold(20);
                }
                return SpireReturn.Return(true);
            }
            return SpireReturn.Continue();
        }
    }
}
